import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from '@nestjs/common';

@Injectable()
export class FileSizeValidationPipePipe implements PipeTransform {
  transform(value: Express.Multer.File, metadata: ArgumentMetadata) {
    if(value.size > 1000 * 1024){
      throw new HttpException('文件大小不能超过1M',HttpStatus.BAD_REQUEST);
    
    }
    return value;
  }
}
 